{extend name="public/base"/}
{block name="body"}
<style>
	.table-responsive{min-height:600px;}
	.main-box-body .navs {
		padding-left: 0;
		list-style: none;
		display: block;
		clear:both;
	}
	.main-box-body .navs>li {
		float: left;
	}
	.main-box-body .navs>li>a {padding:2px 5px;}
	.main-box-body .navs .active{background:#03A9F3;color:#fff;border-bottom:1px solid #fff;}


	//.main-box-body .nav>li>a {padding:2px 5px;}
	//.main-box-body .nav .active{background:#03A9F3;color:#fff;}
	.info{max-width:400px;font-size:12px;}
	.desc{margin-top: 10px;
		text-align: justify;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		-o-text-overflow: ellipsis;
		text-overflow: ellipsis;
		overflow: hidden;
		height: 4.5em;
	}
	.clear{clear:both;}
	.ml {
		margin-left: 10px;
	}
	.ant-tag {
		display: inline-block;
		line-height: 20px;
		height: 22px;
		padding: 0 8px;
		-webkit-border-radius: 4px;
		-moz-border-radius: 4px;
		border-radius: 4px;
		border: 1px solid #e9e9e9;
		background: #f3f3f3;
		font-size: 12px;
		-webkit-transition: all .3s cubic-bezier(.215,.61,.355,1);
		-o-transition: all .3s cubic-bezier(.215,.61,.355,1);
		-moz-transition: all .3s cubic-bezier(.215,.61,.355,1);
		transition: all .3s cubic-bezier(.215,.61,.355,1);
		opacity: 1;
		margin-right: 8px;
		cursor: pointer;
		white-space: nowrap;
	}
	.ant-tag-red {
		color: #f04134;
		background: #fcdbd9;
		border-color: #fcdbd9;
	}
</style>

<div class="main-box clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left" style="width:50%">
			<!---
			<ul class="nav nav-tabs">
				<li >
					<a href="{:url('recommend')}">本周推荐</a>
				</li>
				<li class="active">
					<a href="{:url('index')}">内推榜单（全书库）</a>
				</li>
				<li >
					<a href="{:url('hot')}">派单榜单</a>
				</li>
				
			</ul>--->
				<form method="get">
					<div class="col-sm-12 col-md-4 col-lg-3">
						<input type="text" class="form-control" name="keyword" value="{$keyword|default=''}" placeholder="请输入关键字">
					</div>
					<div class="col-sm-12 col-md-4">
						<button class="btn btn-primary" type="submit">搜索</button>
					</div>
				</form>
		</div>
		<div class="pull-right">
				<!-- {if condition="in_array($group,$access)"} -->
				<!-- <a class="btn btn-primary" href="{:url('admin/thirdnovel/uploadbook?model_id='.$model_id)}">上传</a>
				<a class="btn btn-primary confirm"  id="ajax-href" href="javascript:;" target-priceform="ids">批量设置价格</a>

				<a class="btn btn-primary" href="{:url('admin/thirdnovel/add?model_id='.$model_id)}">新 增</a>
				<button class="btn btn-danger ajax-post confirm" url="{:url('admin/thirdnovel/del?model_id='.$model_id)}" target-form="ids">删 除</button> -->
			<!-- {/if} -->
		</div>
	</header>
	<div class="main-box-body clearfix">

		<ul class="navs clearfix" style="margin: 10px 5px" >
			<li style="margin-top: 4px;"><span class="text-muted">小说源站：</span></li>
			<li ><a href="{:url("thirdnovel/index")}?siteid=0" {empty name="siteid"}class="active"{/empty}>全部</a></li>
			{volist name='cp_member' id="item"}
			<li><a href="{:url("thirdnovel/index")}?siteid={$item.uid}" {eq name="siteid" value="$item.uid"}class="active"{/eq}>{$item.nickname}</a></li>
			
			{/volist}
		</ul>

		<div id="" class="clear"></div>
		<div class="table-responsive clearfix">

			<div class="table-responsive clearfix">
				<table class="table table-hover table-bordered ">
					<thead>
						<tr>
							<th width="30"><input class="checkbox check-all" type="checkbox"></th>
							<th>源站</th>
							{volist name="grid['grids']" id="item"}
							<th>{$item['title']}</th>
							{/volist}
							<th>已推次数</th>
							{if condition="in_array($group,$access)"}
							<th>操作</th>
							{/if}
							{if session('user_auth.group')==4||session('user_auth.group')==3}
								<th>操作</th>
							{/if}
						</tr>
					</thead>
					<tbody>
						{if condition="empty($list)"}
						{php}
						$cow = count($grid['grids'])+2;
						{/php}
						<tr>
							<td colspan="{$cow}" align="center">暂无数据！</td>
						</tr>
						{else/}
						{volist name="list" id="item" key="k"}
						<tr>
							<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
							<td>
								{:getCpsCpMember($item['siteid'])}
								
							</td>
							{volist name="grid['grids']" id="vo"}
								{if isset($vo['format'])}
									<td>{$item[$vo['field'][0]]|$vo['format']}</td>
								{elseif $vo['field'][0] == 'title'}
									<td>
									<a href="{:url('admin/thirdchapter/index?model_id='.$model_id,array('id'=>$item['id']))}">[{$item['category_id']|get_category_list=###}]{$item[$vo['field'][0]]}</a>[{if $item['fullflag']==1}已完结{else}连载中{/if}]<i class="fa fa-question-circle" title="" data-toggle="tooltip" data-original-title="点击查看章节"></i>
									{if $item['top']==1}<div class="ant-tag ant-tag-red" style="background:deepskyblue;color:#fff"><span class="ant-tag-text">顶</span></div>{/if}
									{if $item['articletype']==1}<div class="ant-tag ant-tag-red" style="background:#00CC00;color:#fff"><span class="ant-tag-text">独家</span></div>{/if}
									
									{if (time()-$item['create_time'])/86400<7}<div class="ant-tag ant-tag-red" style="background:#f30;color:#fff"><span class="ant-tag-text">新书</span></div>{/if}

						
									<div class="info">
										<p>上架时间：{$item['create_time']|date='Y-m-d H:i:s',###}</p>
										<p class="desc">{$item['intro']}……
										</p>
										<p>最新章节: {$item['lastvolume']}({$item['update_time']|date='Y-m-d H:i:s',###})</p>
										
										<p class="pull-left"><span>{$item['chapters']}章</span><span class="ml">{$item['size']/10000|round=###,1}万字</span></p>
										
										<p class="pull-right"><span class="book-catagory-tag">{$item['keywords']}</span></p>
									</div>
									</td>
								{elseif $vo['field'][0] == 'cover'}
									<td>
							
									<a href="{:url('admin/thirdchapter/index?model_id='.$model_id,array('id'=>$item['id']))}"><img src="{$item['coverl']?$item['coverl']:"/public/novel/images/default.jpg"}" width="100" height="" alt="" /></a>
									</td>
								{elseif $vo['field'][0] == 'category_id'}
									<td>
									{$item[$vo['field'][0]]|get_category_list=###}</td>
								{elseif $vo['field'][0] == 'channel'}
									<td>
										{switch item[$vo['field'][0]] }
											{case 1 }男频{/case}
											{case 2}女频{/case}
											{default /}通用
										{/switch}
									</td>
								{elseif $vo['field'][0] == 'fullflag'}
									<td>{eq name="item[$vo['field'][0]]" value="1"}
									已完结
									{else/}
									连载中{/eq}</td>
								{elseif $vo['field'][0] == 'index'}
								
									<td>
										{if condition="($item[$vo['field'][0]] == 100)"} {$item[$vo['field'][0]]}(SS级)
									{elseif condition="($item[$vo['field'][0]] >= 95) and ($item[$vo['field'][0]] <= 99)"/}{$item[$vo['field'][0]]}(S级)
									{elseif condition="($item[$vo['field'][0]] >= 90) and ($item[$vo['field'][0]] < 95)"/}
									{$item[$vo['field'][0]]}(A级)
									{else /} -
									{/if}
									</td>
								{else/}
									<td>{$item[$vo['field'][0]]}</td>
								{/if}
							{/volist}
								<td><a href="{:url('admin/spread/index',array('type'=>1,'urltype'=>2))}" target="_blank">{$item['id']|get_spread=###,2}(内推)</a><br/>
								<a href="{:url('admin/spread/index',array('type'=>1,'urltype'=>1))}" target="_blank">{$item['id']|get_spread=###,1}(派单)</a></td>
							{if condition="in_array($group,$access)"}


							<td>
								<!-- <a href="{:url('admin/thirdnovel/edit?model_id='.$model_id,array('id'=>$item['id']))}" >编辑</a> -->
								<a href="{:url('admin/thirdnovel/del?model_id='.$model_id,array('id'=>$item['id']))}" class="ajax-get confirm">删除</a>

								<!-- <a target="_blank" href="{:url('admin/thirdnovel/copy?model_id='.$model_id,array('id'=>$item['id']))}" >复制小说</a> -->

								<div class="btn-group {if $k>(count($list)-3)&&count($list)>5}dropup{/if}">
									<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
											更多设置<span class="caret"></span>
									</button>
										<ul class="dropdown-menu dropdown-menu-right">
							
							{if $Think.config.pc_themes=="cps" || $Think.config.pc_themes=="ieasy"}
								
								<!-- {if in_array(5,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'5'))}" class="ajax-get">[wap]取消读者推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'5'))}" class="ajax-get">[wap]读者推荐</a></li>
								{/if}

								{if in_array(1,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'1'))}" class="ajax-get">[wap]取消火热推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'1'))}" class="ajax-get">[wap]火热短篇</a></li>
								{/if}
								{if in_array(2,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'2'))}" class="ajax-get">[wap]取消新书推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'2'))}" class="ajax-get">[wap]新书推荐</a></li>
								{/if}
								{if in_array(3,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'3'))}" class="ajax-get">[wap]取消小说精选</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'3'))}" class="ajax-get">[wap]小说精选</a></li>
								{/if}

								{if in_array(8,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'8'))}" class="ajax-get">[wap]取消主编力推</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'8'))}" class="ajax-get">[wap]主编力推</a></li>
								{/if}

								{if in_array(4,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'4'))}" class="ajax-get">[pc]取消火热短篇</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'4'))}" class="ajax-get">[pc]火热短篇</a></li>
								{/if}
								{if in_array(6,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'6'))}" class="ajax-get">[pc]取消男生频道推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'6'))}" class="ajax-get">[pc]男生频道推荐</a></li>
								{/if}
								{if in_array(7,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'7'))}" class="ajax-get">[pc]取消女生频道推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'7'))}" class="ajax-get">[pc]女生频道推荐</a></li>
								{/if}
							{else/}
								{if in_array(14,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'14'))}" class="ajax-get">[wap]取消单本推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'14'))}" class="ajax-get">[wap]单本推荐</a></li>
								{/if}

								{if in_array(1,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'1'))}" class="ajax-get">[wap]取消火爆热书</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'1'))}" class="ajax-get">[wap]火爆热书</a></li>
								{/if}
								
								{if in_array(2,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'2'))}" class="ajax-get">[wap]取消潜力新书</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'2'))}" class="ajax-get">[wap]潜力新书</a></li>
								{/if}
								
								{if in_array(3,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'3'))}" class="ajax-get">[wap]取消精品推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'3'))}" class="ajax-get">[wap]精品推荐</a></li>
								{/if}

								{if in_array(8,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'8'))}" class="ajax-get">[wap]取消编辑推荐</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'8'))}" class="ajax-get">[wap]编辑推荐</a></li>
								{/if}
								

								{if in_array(11,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'11'))}" class="ajax-get">[PC]取消大神专区</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'11'))}" class="ajax-get">[PC]大神专区</a></li>
								{/if}
								{if in_array(12,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'12'))}" class="ajax-get">[PC]取消VIP精品区</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'12'))}" class="ajax-get">[PC]VIP精品区</a></li>
								{/if}
								{if in_array(13,explode(',',$item['is_top']))}
									<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'13'))}" class="ajax-get">[PC]取消热销排行榜</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'13'))}" class="ajax-get">[PC]热销排行榜</a></li>
								{/if}
							{/if}

							{if in_array(9,explode(',',$item['is_top']))}
								<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'9'))}" class="ajax-get">取消本周推荐</a></li>
							{else/}
								<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'9'))}" class="ajax-get">本周推荐</a></li>
							{/if}

							{if in_array(10,explode(',',$item['is_top']))}
								<li><a href="{:url('admin/thirdnovel/unsettop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'10'))}" class="ajax-get">取消老牌神书</a></li>
							{else/}
								<li><a href="{:url('admin/thirdnovel/settop?model_id='.$model_id,array('id'=>$item['id'],'is_top'=>'10'))}" class="ajax-get">老牌神书</a></li>
							{/if}
							
							{if isset($item['status'])}
								{if $item['display']==1}
									<li><a href="{:url('admin/thirdnovel/displays?model_id='.$model_id,array('id'=>$item['id'],'status'=>'0'))}" class="ajax-get">隐藏</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/displays?model_id='.$model_id,array('id'=>$item['id'],'status'=>'1'))}" class="ajax-get">显示</a></li>
								{/if}
								{if $item['top']==1}
									<li><a href="{:url('admin/thirdnovel/tops?model_id='.$model_id,array('id'=>$item['id'],'status'=>'0'))}" class="ajax-get">取消置顶</a></li>
								{else/}
									<li><a href="{:url('admin/thirdnovel/tops?model_id='.$model_id,array('id'=>$item['id'],'status'=>'1'))}" class="ajax-get">置顶</a></li>
								{/if}

								{if $item['status']==1}
								<li><a href="{:url('admin/thirdnovel/status?model_id='.$model_id,array('id'=>$item['id'],'status'=>'0'))}" class="ajax-get">取消审核</a></li>
								{else/}
								<li><a href="{:url('admin/thirdnovel/status?model_id='.$model_id,array('id'=>$item['id'],'status'=>'1'))}" class="ajax-get">审核</a></li>
								{/if}
								{/if}
								<li><a href="{:url('admin/thirdnovel/setsize?model_id='.$model_id,array('id'=>$item['id']))}" class="ajax-get">字数统计</a></li>
								<li><a href="{:url('admin/thirdnovel/setvip?model_id='.$model_id,array('id'=>$item['id']))}" >批量设置VIP</a></li>
								<li><a href="{:url('admin/thirdnovel/setprice?model_id='.$model_id,array('id'=>$item['id']))}" >批量设置价格</a></li>
								
								<li><a href="{:url('admin/thirdnovel/chapterupdate?model_id='.$model_id,array('id'=>$item['id']))}" >章节批量更新</a></li> -->
								<li><a href="{:url('admin/thirdnovel/down?model_id='.$model_id,array('id'=>$item['id']))}" ><i class="fa fa-download" aria-hidden="true"></i>全本下载</a></li>

								<!-- <li><a href="{:url('admin/thirdnovelSyncNovel/syncNovel?model_id='.$model_id,array('id'=>$item['id']))}" ><i class="fa fa-plus-circle fa-lg"></i> 一键同步书本到【小说书库】</a></li>
								<li><a href="{:url('admin/thirdnovelSyncNovel/syncChapterAndContent?model_id='.$model_id,array('id'=>$item['id']))}" ><i class="fa fa-clone"></i> 一键同步章节到【小说书库】</a></li> -->

							</ul>
									</div>

							</td>
							
							{/if}

							{if session('user_auth.group')==4||session('user_auth.group')==3}
								<th>
									<div class="btn-group">
									<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
											操作<span class="caret"></span>
									</button>
										<ul class="dropdown-menu dropdown-menu-right">
											<li><a href="JavaScript:;" onclick="priceSettingModal({$item['id']},{if get_diyprice($item['id'],'saleprice')}{$item['id']|get_diyprice=###,'saleprice'}{else /}0{/if},{if get_diyprice($item['id'],'wordsperegold')}{$item['id']|get_diyprice=###,'wordsperegold'}{else /}0{/if})">自定义收费</a></li>
										</ul>
									</div>
								</td>
							{/if}

						</tr>
						{/volist}
						{/if}
					</tbody>
				</table>
			</div>
			{$page}
		</div>
	</div>
</div>

<div class="modal fade" id="custom-price-setting-modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">小说自定义价格</h4>
            </div>
            <div class="modal-body">
              <form class="form-horizontal" >
                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right">选择小说</label>
                  <div class="col-sm-9">
                    <select id ="artcile_select" name="articleid"  style="width:200px">
						{volist name="novel" id="vo"}
							<option value="{$vo.id}" >{$vo.name}</option>
						{/volist}	
                    </select>
                  </div>
                </div>
				{if $Think.config.pricetype==1}
                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right">单章价格</label>
                  <div class="col-sm-9">
                    <select class="form-control" name="saleprice" id="saleprice" style="width:auto;">
                        <option value=""></option>
                        {foreach name="chaptersaleprice" item="vo" key="k" }
							 <option value="{$k}">{$vo}</option>
						{/foreach}
                    </select>
                    <span data-valmsg-for="unit_price" data-valmsg-replace="true"></span>
                  </div>
                </div>
				{else}
				<div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right">千字价格</label>
                  <div class="col-sm-9">
                    <select class="form-control" name="wordsperegold" id="wordsperegold" style="width:auto;">
                        <option value=""></option>
						{foreach name="wordsperegold" item="vo" key="k" }
							 <option value="{$k}">{$vo}</option>
						{/foreach}
                    </select>
                    <span data-valmsg-for="unit_price" data-valmsg-replace="true"></span>
                  </div>
                </div>
				{/if}
				<!---
                <div class="form-group">
                  <label class="col-sm-3 control-label no-padding-right">开始收费章节</label>
                  <div class="col-sm-9">
                    <select name="start_charge_idx" data-bind="value: start_charge_idx">
                                                <option value="7">第 7 章</option>
                                                <option value="8">第 8 章</option>
                                                <option value="9">第 9 章</option>
                                                <option value="10">第 10 章</option>
                                                <option value="11">第 11 章</option>
                                                <option value="12">第 12 章</option>
                                                <option value="13">第 13 章</option>
                                                <option value="14">第 14 章</option>
                                                <option value="15">第 15 章</option>
                                                <option value="16">第 16 章</option>
                                                <option value="17">第 17 章</option>
                                                <option value="18">第 18 章</option>
                                                <option value="19">第 19 章</option>
                                                <option value="20">第 20 章</option>
                                                <option value="21">第 21 章</option>
                                                <option value="22">第 22 章</option>
                                                <option value="23">第 23 章</option>
                                                <option value="24">第 24 章</option>
                                                <option value="25">第 25 章</option>
                                                <option value="26">第 26 章</option>
                                                <option value="27">第 27 章</option>
                                                <option value="28">第 28 章</option>
                                                <option value="29">第 29 章</option>
                                                <option value="30">第 30 章</option>
                                          </select>
                  </div>
                </div>
				---->
               </form>
            </div>
            <div class="modal-footer">
                <button type="button" name="submit" id="setting" class="btn btn-primary">提交</button>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="/public/js/bootstrap-editable.min.js"></script>
<link rel="stylesheet" href="/public/plugs/select2/select2.min.css">
<script type="text/javascript" src="/public/plugs/select2/select2.min.js"></script>
<script type="text/javascript" src="/public/plugs/select2/zh-CN.js"></script>

<script type="text/javascript">
$(function(){
	$('#artcile_select').select2();

	$.fn.editable.defaults.mode = 'popup';
	$.fn.editableform.buttons = '<button type="submit" class="btn btn-success editable-submit btn-mini"><i class="fa fa-check-square-o fa-white"></i></button>' +
	'<button type="button" class="btn editable-cancel btn-mini"><i class="fa fa-times"></i></button>';
	$('.editable').editable();

	$('#ajax-href').click(function() {
		var target, query, form;
		var url  = "{:url('thirdnovel/setprice')}";
		var target_form = $(this).attr('target-priceform');
		var that = this;
		var nead_confirm = false;
		
		if (($(this).attr('type') == 'submit') || (target = $(this).attr('href')) || (target = $(this).attr('url'))) {
			form = $('.' + target_form);
			query = form.serialize();
			if (query)
			{
				window.location.href= url.replace('.html','')+"?"+query;
			}else{
				updateAlert('非法操作', 'danger');
				setTimeout(function() {
					location.reload();
				}, 1500);
			}
			
		}
	})

	//渠道自定义章节价格
	$('#setting').on('click',function(){
		var articleid = $('#artcile_select').val();
		{if $Think.config.pricetype==1}
		var saleprice = $("#saleprice").val();
		var wordsperegold = 0;
		{else}
		var saleprice = 0;
		var wordsperegold = $('#wordsperegold').val();
		{/if}
		
		if (articleid=="" || articleid==" ")
		{
			updateAlert("请选择小说", 'danger');
			return false;
		}
		
		$.ajax({
			type: "POST",
			url: "{:url('thirdnovel/diyprice')}",
			data: {articleid:articleid,saleprice:saleprice,wordsperegold:wordsperegold},
			dataType: "json",
			success: function(data){
				if(data.code==1){
					updateAlert(data.msg, 'success');
					setTimeout(function() {	
						window.location.reload();
					}, 1500);
				}else{
					updateAlert("添加失败", 'danger');
				}
			},
			error : function(e){
                console.log(e.status);
                console.log(e.responseText);
            }
		})
		
		
	})
})

function priceSettingModal(articleid,saleprice,wordsperegold){
	var $modal = $('#custom-price-setting-modal');
	$modal.on('shown.bs.modal', function () {
		$('#artcile_select').select2().val(articleid).trigger("change");
		$('#saleprice').select2().val(saleprice).trigger("change");
		$('#wordsperegold').select2().val(wordsperegold).trigger("change");
	});	
	$modal.modal('show');

}
</script>
{/block}